"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Query = exports.Body = exports.createRouteProperty = exports.Post = exports.Get = exports.Module = exports.Injectable = exports.Controller = void 0;
require("reflect-metadata");
const constant_1 = require("./constant");
function Controller(path) {
    return (target) => {
        Reflect.defineMetadata(constant_1.CONTROLLER, path, target);
    };
}
exports.Controller = Controller;
function Injectable() {
    return (target) => {
    };
}
exports.Injectable = Injectable;
function Module(metadata) {
    return (target) => {
        Reflect.defineMetadata(constant_1.MODULE, metadata, target);
    };
}
exports.Module = Module;
function createRouterMethod(method) {
    return (path) => {
        return (target, propertyKey, descriptor) => {
            Reflect.defineMetadata(constant_1.ROUTER_PATH, path, target, propertyKey);
            Reflect.defineMetadata(constant_1.ROUTER_METHOD, method, target, propertyKey);
        };
    };
}
exports.Get = createRouterMethod('get');
exports.Post = createRouterMethod('post');
function createRouteProperty(type) {
    return (Validate) => {
        return (target, method, index) => {
            const metadata = Reflect.getMetadata(constant_1.PROPERTY, target, method) || [];
            metadata.push({
                type,
                index,
                Validate
            });
            Reflect.defineMetadata(constant_1.PROPERTY, metadata, target, method);
        };
    };
}
exports.createRouteProperty = createRouteProperty;
exports.Body = createRouteProperty('body');
exports.Query = createRouteProperty('query');
